package leetcode.code1309;

import leetcode.IDebug;

public class Solution implements IDebug {

	public String freqAlphabets(String s) {
		char[] cs = s.toCharArray();
		int len = cs.length;
		StringBuffer ans = new StringBuffer();
		int p = len - 1;
		while (p >= 0) {
			char cur = cs[p];
			int idx = 0;
			if (cur == '#') {
				idx = cs[p - 1] - '0' + (cs[p - 2] - '0') * 10 - 1 + 'a';
				p -= 2;
			} else {
				idx = cur - '1' + 'a';
				p--;
			}
			ans.insert(0, (char) idx);
		}
		return ans.toString();
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
